package com.xmqian.app.project.ui.main.fragment

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.coszero.common.config.IntentKey
import com.coszero.common.widget.banner.AutoBannerView
import com.coszero.common.widget.banner.BannerUtils
import com.example.xmqian.databinding.FragmentMainPage1Binding
import com.xmqian.app.project.common.base.BaseMyFragment
import com.xmqian.app.project.common.testdata.TestData

class MainPage1Fragment : BaseMyFragment() {
    var mBranner: AutoBannerView? = null
    private var binding: FragmentMainPage1Binding? = null

    override fun initView() {
        requireArguments()
        mBranner = binding!!.includeBanner.vpBanner
        setTitle(arguments!!.getString(IntentKey.EXTRA_TITLE))
        BannerUtils.startBanner(mBranner, TestData.getBanners())
    }

    override fun initData() {
    }

    override fun lazyLoadData() {
    }

    override fun getLayoutView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        attachToParent: Boolean
    ): View {
        binding = FragmentMainPage1Binding.inflate(inflater, container, attachToParent)
        return binding!!.root
    }

    companion object {
        fun newInstance(title: String?): MainPage1Fragment {
            val args = Bundle()
            args.putString(IntentKey.EXTRA_TITLE, title)
            val fragment = MainPage1Fragment()
            fragment.arguments = args
            return fragment
        }
    }
}
